package me.shurufa.activities;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import butterknife.Bind;
import me.shurufa.R;
import me.shurufa.utils.Global;

/**
 * 在此写用途
 *
 * @FileName: me.shurufa.activities.BaseInfoActivity.java
 * @author: kHRYSTAL
 * @email: 723526676@qq.com
 * @date: 2016-01-19 16:39
 */
public class BaseInfoActivity extends BaseActivity implements View.OnClickListener {

    @Bind(R.id.nick_name_layout)
    LinearLayout nickNameLayout;
    @Bind(R.id.description_layout)
    LinearLayout descriptionLayout;
    @Bind(R.id.mobile_number)
    TextView mobileNumber;
    @Bind(R.id.register_mobile_layout)
    LinearLayout registerMobileLayout;
    @Bind(R.id.modify_password_layout)
    LinearLayout modifyPasswordLayout;
    @Bind(R.id.email_layout)
    LinearLayout emailLayout;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        activity_layout_res = R.layout.activity_baseinfo;
        super.onCreate(savedInstanceState);
        initUI();
    }

    private void initUI() {
        titleTextView.setText(getString(R.string.base_info));
        nickNameLayout.setOnClickListener(this);
        modifyPasswordLayout.setOnClickListener(this);
        descriptionLayout.setOnClickListener(this);
        emailLayout.setOnClickListener(this);
        if (Global.currentUser!=null){
            mobileNumber.setText(Global.currentUser.mobile);
        }

    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()){
            case R.id.nick_name_layout:
                intent = new Intent(BaseInfoActivity.this,ModifyNicknameActivity.class);
                startActivity(intent);
                break;
            case R.id.modify_password_layout:
                intent = new Intent(BaseInfoActivity.this,ModifyPasswordActivity.class);
                startActivity(intent);
                break;
            case R.id.email_layout:
                intent = new Intent(BaseInfoActivity.this,ModifyEmailActivity.class);
                startActivity(intent);
                break;
            case R.id.description_layout:
                intent = new Intent(BaseInfoActivity.this,ModifyDescriptionActivity.class);
                startActivity(intent);
                break;
        }
    }
}
